package ferp.core.state;

import ferp.core.game.Game;
import ferp.core.game.Input;
import ferp.core.game.Settings;
import ferp.core.player.Profile;

/**
 * User: olegs
 * Date: 10/14/12 10:00 AM
 */
public class ShowPool2 extends State
{
  @Override
  public int process(Game.Listener listener, Profile profile, Game g, Settings settings, Input input) throws Game.Error
  {
    switch (input.puc)
    {
      case SHOW_INITIAL_POSITION:
        g.set(State.showInitialPosition);

        break;

      case REPLAY:
        // start replay
        profile.startReplay();
        // notify user about replay start
        listener.onReplayStart();

        break;

      default:
        if (g.replay)
        {
          // stop the replay
          profile.stopReplay();
          // notify user about replay end
          listener.onReplayEnd();
        }
        else
          g.set(State.end);

        break;
    }

    return Result.SCHEDULE;
  }
}
